package src.test;

import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;

public class ThreadClientBis extends Thread
{
	
	public void run()
	{
		Socket comm = null;
		InputStream is = null;
		boolean bool=true;
		 
		try
		{
			while(bool==true)
			{
				comm = new Socket("localhost", 8070);
		    	comm.getOutputStream().write("Bonjour je suis le client 2\n\n".getBytes());
		    	is = comm.getInputStream();
		    	int c=0;
		    	while((c = is.read()) != -1)
		    	{
		    		System.out.print(" ");
		    		System.out.write(c);
		    	}
			}
		}
		catch(Exception e)
		{
			System.err.println("Exception " + e.toString());
		}
		finally
		{
			if (is!=null)
				try 
				{
					is.close();
				} catch (IOException e) {e.printStackTrace();}
		    if (comm!=null)
				try 
		    	{
					comm.close();
				} catch (IOException e) {e.printStackTrace();}
		}
	}
}
